clear
clear mata
clear matrix

cd ..        /* Goes back to parent folder */


capture log close
log using "log\05_NARA.log", replace

mkdir /tmp                                                                      /* creates a temporary folder to store temp files */


*       Patriotism!

*       FIRST VERSION  June       8, 2022
*       THIS VERSION   June       8, 2022
*       LAST RUN       June       8, 2022

*       LAST REVISOR		AT

*       Log of revisions:

*       This prepares NARA variables

********************************************************************************
****                      PLAN OF THE PROCEDURE                             ****
****                                                                        ****
****  1. Prepare the geographical bridges                             	    ****
****  2. Assume data                                                   		****
****  3. Label and save 							  					    ****
****  4. Prepare database for men                                           ****
****  5. Prepare database for women                                         ****
****  6. Erase junk				                                            ****
********************************************************************************


********************************************************************************
****  1. Prepare the geographical bridges                             	    ****
****              a. State of residence                                     ****
********************************************************************************
use "rawdata/NARA/Bridge-statearmy-state", replace  

gen     ltd        =                strpos(state,", LIMITED SERVICE")        > 1
gen     objector   =                strpos(state,", CONSCIENTIOUS OBJECTOR") > 1

gen     stateclean =                       state
replace stateclean = substr(state,1,strpos(state,", LIMITED SERVICE")        - 1) if ltd      == 1
replace stateclean = substr(state,1,strpos(state,", CONSCIENTIOUS OBJECTOR") - 1) if objector == 1

replace stateclean = proper(stateclean)

ren     state      statenamearmy
ren     stateclean state

replace state = "District of Columbia" if state == "District Of Columbia"

merge m:1      state using "rawdata/ICPSR/ICPSR-States"   , nogen keepus(stateicpsr)

replace state = "" if stateicpsr == .

merge m:1      state using "rawdata/NARA/ServiceCommands", nogen

compress
order state*

lab def ltd_lbl 0 "No limitations" 1 "Limited service"
lab val ltd     ltd_lbl 

lab def objector_lbl 0 "No limitations" 1 "Conscientious objector"
lab val objector     objector_lbl

lab var statearmy      "State code (army)"
lab var statenamearmy  "State name (army)"
lab var state          "State name (ICPSR)"
lab var stateicpsr     "State code (ICPSR)"
lab var ltd            "Limited service"
lab var objector       "Conscientious objector"
lab var servicecommand "Service command (HI, AK = 10)"

save "tmp/Bridge-states", replace

********************************************************************************
****  2. Assume data                                                   		****
****            a. Get the data                                             ****
********************************************************************************
clear
quietly infix                  ///
  str     serial      1-8      ///
  str     fullname    9-32     ///
  str     statearmy  33-34     ///
  str     countyarmy 35-37     ///
  int     poe        38-41     ///
  byte    doe        42-43     ///
  byte    moe        44-45     ///
  byte    yoe        46-47     ///
  str     grade_d    52-52     ///  Note: field 48-51 is grade (alphabetic version ---very messy)
  byte    branch_d   56-57     ///  Note: field 58 is always empty (in documentation: "FIELD USE AS DESIRED"). Field 53-55 is branch (alphabetic version ---very messy)
  byte    toe        59-59     ///
  str     longevity  60-62     ///
  str     source0    63-63     ///
  str     pobarmy    64-65     ///
  byte    yobarmy    66-67     ///
  str     race0      68-68     ///
  byte    educ_d     69-69     ///
  int     occ_d      70-72     ///
  byte    marital0   73-73     ///
  int     height     74-75     ///
  int     weight     76-78     ///
  byte    component0 79-79     ///
  str     cardn      80-80     ///
  int     boxn       81-84     ///
  str     reel       85-89     ///
	 using "rawdata/NARA/ASNEF.FIN.DAT"
********************************************************************************
****              b. Drop records that don't belong here                    ****
****                    i. Reserve corps                                    ****
********************************************************************************
drop if longevity != ""     /* these are 333,446 records that belong to the Reserve Corps Records and have a different record pattern */
drop    longevity

********************************************************************************
****                   ii. Duplicates (mostly officers)                     ****
********************************************************************************
duplicates drop     /* this drops 162508 observations */

********************************************************************************
****       3. Clean variable of interest                                    ****
****              a. Marital status + dependency                            ****
********************************************************************************
gen byte marital   = cond(marital0 == 1 | marital0 == 6,1,        /// single (with and without dependants)
                     cond(marital0 == 2                ,2,        /// married (with dependant)
			         cond(marital0 == 3 | marital0 == 7,3,        /// separated (with and without dependants)
			         cond(marital0 == 4 | marital0 == 8,4,        /// divorced (with and without dependants)
			         cond(marital0 == 5 | marital0 == 9,5,.)))))   /* widow (with and without dependants) */

drop marital0


********************************************************************************
****              b. Component of the army                                  ****
********************************************************************************
gen byte component = cond(component0 == 1                  ,1,        ///  Regular army
                     cond(component0 == 4                  ,2,        ///  National Guards
                     cond(component0 == 2 | component0 == 3,3,        ///  Reserves
                     cond(component0 == 5                  ,4,        ///  Philippines Scouts
                     cond(component0 == 6                  ,5,        ///  Army of the US
                     cond(component0 == 7                  ,6,        ///  Enlisted (selectees)
                     cond(component0 == 9                  ,9,.)))))))  /* Women */
					 
gen byte sex = component == 9 

gen serial1   = substr(serial,1,1)
gen volunteer = cond(serial1 == "1"                 ,1,                   /// Volunteers
                cond(serial1 == "3" | serial1 == "4",0,.))                /*  Enlisted men (selectees) */
drop component0 serial1


********************************************************************************
****              c. Education                                              ****
********************************************************************************
recode educ_d (1 = 11) (2 = 12) (3 = 13) (4 = 14) (5 = 21) (6 = 22) (7 = 23) (8 = 24) (9 = 30)
gen byte educ = floor(educ_d / 10)

********************************************************************************
****              d. Race & citizenship                                     ****
********************************************************************************
gen byte race    = cond(race0 == "1" | race0 == "J",1,            ///
                   cond(race0 == "2" | race0 == "K",2,            ///
                   cond(race0 == "3" | race0 == "L",3,            ///
                   cond(race0 == "4" | race0 == "M",4,            ///
                   cond(race0 == "5" | race0 == "N",5,            ///
                   cond(race0 == "6" | race0 == "O",6,            ///
                   cond(race0 == "7" | race0 == "P",7,            ///
                   cond(race0 == "8" | race0 == "Q",8,            ///
                   cond(race0 == "9" | race0 == "R",9,.)))))))))
gen byte citizen = cond(race0 == "1" |  race0 == "2" |  race0 == "3" |  race0 == "4" |  race0 == "5" |  race0 == "6" |  race0 == "7" |  race0 == "8" |  race0 == "9",1,  ///
                   cond(race0 == "J" |  race0 == "K" |  race0 == "L" |  race0 == "M" |  race0 == "N" |  race0 == "O" |  race0 == "P" |  race0 == "Q" |  race0 == "R",0,.)) 
drop race0
								
********************************************************************************
****              e. State of residence                                     ****
********************************************************************************
merge m:1 statearmy using "tmp/Bridge-states", nogen keep(mas mat)

replace state = "" if countyarmy == "000"
for VAR in var stateicpsr ltd objector servicecommand : replace VAR = . if countyarmy == "000"

gen foreign = countyarmy == "000"
drop state

********************************************************************************
****              f. County of residence                                    ****
********************************************************************************
destring countyarmy, replace force   /* 1 observation from Indiana with counyarmy = "0 9" (ambiguous: it could be 009 or 049, for instance) and 160,392 with countyarmy = "AT". These are the officers! */

merge m:1 statearmy countyarmy using "rawdata/NARA/Bridge-countyarmy-county", nogen keep(mas mat) keepusing(countynamearmy county countyicpsr)    
                                   /* Not matched 3366 counties from using (that's fine, I guess).
								      From master 1,228,136 not matched. Old numbers read as follows.
									  Of these, 286,918 (20.66%) have county = 0 or missing 
									            873,870 (62.92%) are from AK, HI, or foreign countries 
												227,980 (16.42%) seem mistakes. */

********************************************************************************
****              g. Place of birth                                         ****
********************************************************************************
merge m:1 pobarmy using "rawdata/NARA/Bridge-pobarmy-pob", nogen keep(mas mat) keepus(pobnamearmy pob)   /* 580,340 observations not matched from master */  /*da dove viene?*/

********************************************************************************
****              h. Year of enlistment                                     ****
********************************************************************************
replace yoe = . if yoe < 38 | yoe > 47   /* 41601 missings created. These are mistakes */

********************************************************************************
****              i. Year of birth                                          ****
********************************************************************************
gen     yob = yobarmy
replace yob = 1900 + yob if yobarmy <= 35
replace yob = 1800 + yob if yobarmy >  35

replace yob = . if yob > 1929        /*  4113 set to missing */
replace yob = . if yob < 1880        /* 72286 set to missing */

********************************************************************************
****              l. Name, surname and middle name                          ****
********************************************************************************
split fullname, p(" ") gen(name)

gen patronimic = 0
for START in any MC MAC VAN VON LA LE LI LO DA DE DEL DI DU ST : replace patronimic = 1 if name1 == "START"
                 
gen    surname =     cond(patronimic == 1,name1 + " " + name2,name1)
gen       name =     cond(patronimic == 1,name3              ,name2)
gen     miname = subinstr(subinstr(fullname,surname + " ","",.),name,"",.)
replace miname =     trim(miname)

drop name1-patronimic 

********************************************************************************
****              m. Unique serial number                                   ****
********************************************************************************
sort stateicpsr statearmy statenamearmy countyicpsr county countyarmy countynamearmy foreign servicecommand serial fullname pob pobarmy pobnamearmy yob yobarmy race height weight citizen educ educ_d occ_d marital  poe doe moe yoe volunteer ltd objector component
bysort serial : gen n = _n

tostring n, replace

replace n = "0"  + n if length(n) == 2
replace n = "00" + n if length(n) == 1

gen serialu = serial + n
drop n

********************************************************************************
****  3. Label database                                                   	****
********************************************************************************

lab def marital_lbl 1 "Single" 2 "Married" 3 "Separated" 4 "Divorced" 5 "Widow(er)"
lab val marital     marital_lbl

lab def component_lbl 1 "Regular Army" 2 "National Guard" 3 "Reserve" 4 "Philippine Scout" 5 "Army of the US" 6 "Enlisted" 9 "Women"
lab val component     component_lbl 

lab def volunteer_lbl 0 "Inducted" 1 "Volunteer"
lab val volunteer     volunteer_lbl
 

lab def educ_d_lbl 0 "Grammar school" 11 "1 year of high school" 12 "2 years of high school" 13 "3 years of high school" 14 "4 years of high school" 21 "1 year of college" 22 "2 years of college" 23 "3 years of college" 24 "4 years of college" 30 "Post-graduate"
lab val educ_d     educ_d_lbl

lab def educ_lbl 0 "Grammar school" 1 "High school" 2 "College" 3 "Post-graduate"
lab val educ     educ_lbl

lab def race_lbl 1 "White" 2 "Black" 3 "Chinese" 4 "Japanese" 5 "Hawaiian" 6 "American Indian" 7 "Filipino" 8 "Puerto Rican" 9 "Others"
lab val race     race_lbl

lab def citizen_lbl 0 "Not yet a citizen" 1 "Citizen"
lab val citizen     citizen_lbl

lab def foreign_lbl 0 "Resident in the US" 1 "Resident abroad"
lab val foreign     foreign_lbl

lab def pob_lbl 1 "Connecticut" 2 "Maine" 3 "Massachusetts" 4 "New Hampshire" 5 "Rhode Island" 6 "Vermont" 11 "Delaware" 12 "New Jersey" 13 "New York" 14 "Pennsylvania" 21 "Illinois" 22 "Indiana" 23 "Michigan" 24 "Ohio" 25 "Wisconsin" 31 "Iowa" 32 "Kansas" 33 "Minnesota" 34 "Missouri" 35 "Nebraska" 36 "North Dakota" 37 "South Dakota" 40 "Virginia" 41 "Alabama" 42 "Arkansas" 43 "Florida" 44 "Georgia" 45 "Louisiana" 46 "Mississippi" 47 "North Carolina" 48 "South Carolina" 49 "Texas" 51 "Kentucky" 52 "Maryland" 53 "Oklahoma" 54 "Tennessee" 56 "West Virginia" 61 "Arizona" 62 "Colorado" 63 "Idaho" 64 "Montana" 65 "Nevada" 66 "New Mexico" 67 "Utah" 68 "Wyoming" 71 "California" 72 "Oregon" 73 "Washington" 81 "Alaska" 82 "Hawaii" 98 "District Of Columbia" 110 "Puerto Rico" 130 "Panama" 150 "Canada" 200 "Mexico" 250 "Cuba" 400 "Denmark" 401 "Finland" 404 "Norway" 405 "Sweden" 410 "England" 414 "Ireland" 420 "Belgium" 421 "France" 425 "Netherlands" 426 "Swizterland" 430 "Albania" 433 "Greece" 434 "Italy" 436 "Portugal" 438 "Spain" 450 "Austria" 451 "Bulgaria" 452 "Czechoslovakia" 453 "Germany" 454 "Hungary" 455 "Poland" 456 "Romania" 457 "Yugoslavia" 462 "Lithuania" 465 "Russia" 500 "China" 501 "Japan" 515 "Philippines" 542 "Turkey" 600 "Egypt"
lab val pob     pob_lbl

lab def stateicpsr_lbl  1 "Connecticut" 2 "Maine" 3 "Massachusetts" 4 "New Hampshire" 5 "Rhode Island" 6 "Vermont" 11 "Delaware" 12 "New Jersey" 13 "New York" 14 "Pennsylvania" 21 "Illinois" 22 "Indiana" 23 "Michigan" 24 "Ohio" 25 "Wisconsin" 31 "Iowa" 32 "Kansas" 33 "Minnesota" 34 "Missouri" 35 "Nebraska" 36 "North Dakota" 37 "South Dakota" 40 "Virginia" 41 "Alabama" 42 "Arkansas" 43 "Florida" 44 "Georgia" 45 "Louisiana" 46 "Mississippi" 47 "North Carolina" 48 "South Carolina" 49 "Texas" 51 "Kentucky" 52 "Maryland" 53 "Oklahoma" 54 "Tennessee" 56 "West Virginia" 61 "Arizona" 62 "Colorado" 63 "Idaho" 64 "Montana" 65 "Nevada" 66 "New Mexico" 67 "Utah" 68 "Wyoming" 71 "California" 72 "Oregon" 73 "Washington" 81 "Alaska" 82 "Hawaii" 98 "District of Columbia" 
lab val stateicpsr stateicpsr_lbl


********************************************************************************
****  4. Prepare database for men                                           ****
********************************************************************************
preserve
 
keep if volunteer   !=    .    /*  692604 dropped (of which: 133,060 women, 160,392 officers) */
keep if foreign     ==    0    /*  110948 dropped */
keep if stateicpsr  !=   81    /*  429036 dropped (Alaska) */
keep if stateicpsr  !=   82    /*  202959 dropped (Hawaii) */
keep if stateicpsr  !=    .    /*  373680 dropped */
keep if countyicpsr !=    .    /*   27504 dropped */
keep if pob         !=    .    /*  175586 dropped */
keep if yob         !=    .    /*    4300 dropped */
keep if yoe         !=    .    /*    2003 dropped */
keep if yob         >= 1900    /*   64796 dropped */
drop statearmy statenamearmy countyarmy countynamearmy pobarmy yobarmy pobnamearmy foreign

destring serialu, replace
format   serialu %20.0f

********************************************************************************
****       		a. Merge to counties                                        ****
********************************************************************************

replace countyicpsr = 6900 if stateicpsr == 40 & countyicpsr == 6060 /* Martinsville, Virginia. There should be none from this county (probably already moved to Henry co.) */
replace countyicpsr = 7850 if stateicpsr == 40 & countyicpsr == 8080 /* South Norfolk, Virginia. There should be none from this county (probably already moved to Norfolk)  */
replace countyicpsr =  270 if stateicpsr == 65 & countyicpsr ==  250 /* Pershing, Nevada.  */
replace countyicpsr =  250 if stateicpsr == 65 & countyicpsr ==    5 /* Carson, Nevada is really Ormsby, Nevada.  */
replace countyicpsr =  610 if stateicpsr == 72 & countyicpsr ==  605 /* Union, Oregon.  */

replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr ==  410 /* Campbell, Georgia already belonged to Fulton in the 1940 shapefile. */
replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr == 2030 /* Milton, Georgia already belonged to Fulton in the 1940 shapefile. */

replace county      = "Fulton/Campbell/Milton" if countyicpsr == 1210 & stateicpsr == 44

********************************************************************************
****         	b. Collapse at the county level                             ****
********************************************************************************
gen WW2VOL     = volunteer == 1
gen WW2SOLD    =              1
gen WW2VOLDA   = volunteer == 1 if (1941 - yob) >= 18 & (1941 - yob) <= 44


collapse (sum) WW2VOL WW2SOLD WW2VOLDA, by(stateicpsr countyicpsr county)

ren      countyicpsr countyicpsr40

merge 1:m stateicpsr countyicpsr40 using "data/Bridge-countyicpsr1940-countynd", nogen keep(mat)  
                                                    /* Not matched are 38 observations from 28 counties: 24 VA, 2 TX, 1 AZ, 1 MT. 
													   For the 24 VA counties no New Deal info is available from Fishback et al. 2003.
													   The 2 counties in TX do not seem to exist in the list of counties provided by NARA
													   Cochise in AZ exists in the NARA list, but none signed up from there. 
													   MT is Yellowstone and has missing data from Fishback et al. 2003. */


for VAR in var WW2VOL WW2SOLD WW2VOLDA : replace VAR = VAR * weight40

collapse (sum) WW2VOL WW2SOLD WW2VOLDA , by(stateicpsr countynd)
													   
lab var WW2VOL    "WW2: Number volunteers (ASN-NARA)"
lab var WW2SOLD   "WW2: Number army soldiers (ASN-NARA)"
lab var WW2VOLDA  "WW2: Number of volunteers who were draft age (18-44) in 1941 (ASN-NARA)"

save "data/volunteers_ww2", replace

********************************************************************************
****  5. Prepare database for women                                         ****
********************************************************************************
restore

preserve

keep if component   ==    9														/* keep only women */
keep if foreign     ==    0    
keep if stateicpsr  !=   81    
keep if stateicpsr  !=   82   
keep if stateicpsr  !=    .    
keep if countyicpsr !=    .    
keep if pob         !=    .    
keep if yob         !=    .    
keep if yoe         !=    .    
keep if yob         >= 1900  

drop statearmy statenamearmy countyarmy countynamearmy pobarmy yobarmy pobnamearmy foreign

destring serialu, replace

********************************************************************************
****       		a. Merge to counties                                        ****
********************************************************************************

replace countyicpsr = 6900 if stateicpsr == 40 & countyicpsr == 6060 /* Martinsville, Virginia. There should be none from this county (probably already moved to Henry co.) */
replace countyicpsr = 7850 if stateicpsr == 40 & countyicpsr == 8080 /* South Norfolk, Virginia. There should be none from this county (probably already moved to Norfolk)  */
replace countyicpsr =  270 if stateicpsr == 65 & countyicpsr ==  250 /* Pershing, Nevada.  */
replace countyicpsr =  250 if stateicpsr == 65 & countyicpsr ==    5 /* Carson, Nevada is really Ormsby, Nevada.  */
replace countyicpsr =  610 if stateicpsr == 72 & countyicpsr ==  605 /* Union, Oregon.  */

replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr ==  410 /* Campbell, Georgia already belonged to Fulton in the 1940 shapefile. */
replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr == 2030 /* Milton, Georgia already belonged to Fulton in the 1940 shapefile. */

replace county      = "Fulton/Campbell/Milton" if countyicpsr == 1210 & stateicpsr == 44

********************************************************************************
****         	b. Collapse at the county level                             ****
********************************************************************************

gen WW2WVOLDA   = component == 9 if (1941 - yob) >= 18 & (1941 - yob) <= 44

collapse (sum) WW2WVOLDA, by(stateicpsr countyicpsr county)

ren      countyicpsr countyicpsr40
merge 1:m stateicpsr countyicpsr40 using "data/Bridge-countyicpsr1940-countynd", nogen keep(mat)  


replace WW2WVOLDA = WW2WVOLDA * weight40

collapse (sum) WW2WVOLDA , by(stateicpsr countynd)
													   
lab var WW2WVOLDA  "WW2: Number of female volunteers who were draft age (18-44) in 1941 (ASN-NARA)"


save "data/volunteers_ww2_women", replace

restore 

********************************************************************************
****  6. Prepare individual database                                        ****
********************************************************************************
keep if volunteer   !=    .    /*  692604 dropped (of which: 133,060 women, 160,392 officers) */
keep if foreign     ==    0    /*  110948 dropped */
keep if stateicpsr  !=   81    /*  429036 dropped (Alaska) */
keep if stateicpsr  !=   82    /*  202959 dropped (Hawaii) */
keep if stateicpsr  !=    .    /*  373680 dropped */
keep if countyicpsr !=    .    /*   27504 dropped */
keep if pob         !=    .    /*  175586 dropped */
keep if yob         !=    .    /*    4300 dropped */
keep if yoe         !=    .    /*    2003 dropped */
keep if yob         >= 1900    /*   64796 dropped */
drop statearmy statenamearmy countyarmy countynamearmy pobarmy yobarmy pobnamearmy foreign cardn boxn reel


********************************************************************************
****  	i. Collapse for ASN individual                                      ****
********************************************************************************

preserve

replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr ==  410 /* Campbell, Georgia already belonged to Fulton in the 1940 shapefile. */
replace countyicpsr = 1210 if stateicpsr == 44 & countyicpsr == 2030 /* Milton, Georgia already belonged to Fulton in the 1940 shapefile. */

replace county      = "Fulton/Campbell/Milton" if countyicpsr == 1210 & stateicpsr == 44


gen WW2VOL     = volunteer == 1
gen WW2SOLD    =              1
gen WW2VOL42   = volunteer == 1 & (yoe == 42 | (yoe == 41 & moe == 12))
gen WW2SOLD42  =                  (yoe == 42 | (yoe == 41 & moe == 12))

gen WW2VOLDA   = volunteer == 1 if (1941 - yob) >= 18 & (1941 - yob) <= 44
gen WW2SOLDDA  =              1 if (1941 - yob) >= 18 & (1941 - yob) <= 44

collapse (sum) WW2VOL WW2SOLD WW2VOLDA, by(stateicpsr countyicpsr county)

ren      countyicpsr countyicpsr40

lab var WW2VOL    "WW2: Number volunteers (ASN-NARA)"
lab var WW2SOLD   "WW2: Number army soldiers (ASN-NARA)"
lab var WW2VOLDA  "WW2: Number of volunteers who were draft age (18-44) in 1941 (ASN-NARA)"

save "data/volunteers_ww2_ASN", replace

********************************************************************************
****  	ii. Individual data			                                        ****
********************************************************************************

restore
ren      countyicpsr countyicpsr40

tostring occ_d, gen(occ)
drop if occ_d == 999

gen      OCC = substr(occ,1,1)
destring OCC, replace
gen agri = OCC == 3

gen farmer      = occ_d == 301 | occ_d == 302 | occ_d == 303 | occ_d == 304 | occ_d == 305 | occ_d == 306 | occ_d == 307 | occ_d == 308 | occ_d == 309 | occ_d == 336
gen farmhand    = occ_d == 311 | occ_d == 312 | occ_d == 313 | occ_d == 314 | occ_d == 315 | occ_d == 316 | occ_d == 317 | occ_d == 318 | occ_d == 319

gen h           = height / 39.37 if height > 50  & height < 80     /* feet 2 m */
gen w           = weight / 2.205 if weight > 100 & weight < 300    /* pound 2 kg */
gen bmi                        = w      / (h^2)
gen C40NONWHITE = race    != 1
gen C40MARRIED  = marital != 1
gen noncitizen  = citizen == 0
gen C40SCHOOL_E = educ    == 0
gen C40SCHOOL_H = educ    == 1
gen C40SCHOOL_C = educ    >  1 & educ != .
gen C40AGE      = 1940    - yob 

keep if agri == 1
keeporder stateicpsr countyicpsr40 volunteer farmer farmhand h w bmi C40NONWHITE C40MARRIED noncitizen C40SCHOOL_E  C40SCHOOL_H C40SCHOOL_C C40AGE occ_d agri

lab var stateicpsr           		 "State code (ICPSR)"
lab var countyicpsr40  				 "County code (ICPSR 1940)"
lab var volunteer					 "Volunteer (ASN-NARA)"
lab var farmer                       "Farmer (ASN-NARA)"
lab var farmhand                     "Farm-hand (ASN-NARA)"
lab var h                            "Height (ASN-NARA)"
lab var w                            "Weight (ASN-NARA)"
lab var bmi                          "BMI (ASN-NARA)"
lab var C40NONWHITE                  "Non white (ASN-NARA)"
lab var C40MARRIED                   "Ever married (ASN-NARA)"
lab var noncitizen                   "Non citizen (ASN-NARA)"
lab var C40SCHOOL_E                  "Elementary school (ASN-NARA)"
lab var C40SCHOOL_H                  "High school (ASN-NARA)"
lab var C40SCHOOL_C                  "College (ASN-NARA)"
lab var C40AGE						 "Age in 1940 (ASN-NARA)"
lab var agri						 "Agricultural occupation (ASN-NARA)"

save "data/ASN-NAR"A, replace

********************************************************************************
****  6. Erase junk				                                            ****
********************************************************************************
erase "tmp/Bridge-states.dta"

rmdir "tmp/"

log close
exit